package io.jt808.proto.cmd;

import io.norland.buffer.AutoBuffer;
import io.norland.annotations.Proto;
import io.norland.proto.IProto;
import lombok.Data;

/**
 * 行驶记录参数下传命令
 */
@Proto("8701")
@Data
public class JT8701 implements IProto {
    /**
     * GB/T 19056命令字(有兴趣的请自行实现)
     */
    private byte commandWord;

    /**
     * GB/T 19056数据包
     */
    private byte[] pkg;

    public final byte[] writeToBytes() {
        AutoBuffer buffer = new AutoBuffer();
        buffer.writeByte(commandWord);
        buffer.writeBytes(pkg);
        return buffer.array();
    }

    public final void readFromBuf(AutoBuffer buffer) {
        commandWord = buffer.readByte();
        pkg = buffer.readBytes();
    }
}